//
//  LOLFitCellHeight.m
//  LOLXXbox
//
//  Created by mac on 16/2/27.
//  Copyright © 2016年 Grasstrio. All rights reserved.
//

#import "LOLFitCellHeight.h"

@implementation LOLFitCellHeight

/**
 *  计算文本高度
 *
 *  @param word  传入文本字符串
 *  @param size  传入字体大小
 *  @param width 暂时传屏幕宽,还在调研
 *
 *  @return 返回label高度
 */
+(CGFloat)computeLabelString:(NSString *)word FontSize:(CGFloat)size width:(CGFloat)width
{
    NSDictionary *fontDic=[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:size],NSFontAttributeName, nil];
    CGRect rect=[word boundingRectWithSize:CGSizeMake(width, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:fontDic context:nil];
    return rect.size.height;
    
    
    
}
+(CGFloat)computeLabelCellLabel:(UILabel *)label fontSize:(CGFloat)size frame:(CGRect)frame
{
    NSDictionary *fontDic=[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:size],NSFontAttributeName,nil];
    CGRect rect=[label.text boundingRectWithSize:CGSizeMake(frame.size.width, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:fontDic context:nil];
    label.font=[UIFont systemFontOfSize:size];
    label.numberOfLines=0;
    [label sizeToFit];
    label.frame=CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, rect.size.height);
    return rect.size.height;
    
    
    
}
+(CGFloat)computeCollectionViewNumData:(NSInteger)dataNum ItemHeight:(CGFloat)height numOflines:(CGFloat)number
{
    
    return  ceil(dataNum/number)*height;
    
    
    return 0;
}
@end

